package com.lc.hot100.lc141;

import com.lc.utils.ListNode;

public class Main {

}

class Solution {
    public boolean hasCycle(ListNode head) {
        ListNode fast = head, slow = head;
        
        while(fast != null) {
        	fast = fast.next;
        	slow = slow.next;
        	if (fast == null) {
        		return false;
        	}
        	fast = fast.next;
        	if (fast != null && fast == slow) {
        		return true;
        	}
        }
        return false;
    }
    
    
}
